<?php
// No direct access to this file
defined('_JEXEC') or die;
 
// import the list field type
jimport('joomla.html.html');
jimport('joomla.form.formfield');
 
/**
 * NGMenu Form Field class for the NGMenu component
 */
class JFormFieldImagePreview extends JFormField
{
	/**
	 * The field type.
	 *
	 * @var		string
	 */
	protected $type = 'ImagePreview';
 
//	public function getLabel() {
//	}
 
	public function getInput() {
		
		if ($this->name == 'jform[icon_normal_preview]'){
			$id = 'icon-normal';
			$file = $this->form->getValue('icon_normal') == '' ? JURI::root().'modules/mod_ngmenu/mod_ngmenu/images/blank20.gif' : JURI::root().$this->form->getValue('icon_normal');
			$style = 'width:20px; height:18px; margin-top:0px; border:none;';
		}
		if ($this->name == 'jform[icon_over_preview]'){
			$id = 'icon-over';
			$file = $this->form->getValue('icon_over') == '' ? JURI::root().'modules/mod_ngmenu/mod_ngmenu/images/blank20.gif' : JURI::root().$this->form->getValue('icon_over');
			$style = 'width:20px; height:18px; margin-top:0px; border:none;';
		}
		if ($this->name == 'jform[main_arrow_image_normal_preview]'){
			$id = 'main-arrow_image_normal';
			$file = JURI::root().$this->form->getValue('main_arrow_image_normal');
			$style = 'width:8px; height:8px; margin-top:7px; margin-left:7px; border:none;';
		}
		if ($this->name == 'jform[main_arrow_image_over_preview]'){
			$id = 'main-arrow_image_over';
			$file = JURI::root().$this->form->getValue('main_arrow_image_over');
			$style = 'width:8px; height:8px; margin-top:7px; margin-left:7px; border:none;';
		}
		if ($this->name == 'jform[main_arrow_image_active_preview]'){
			$id = 'main-arrow_image_active';
			$file = JURI::root().$this->form->getValue('main_arrow_image_active');
			$style = 'width:8px; height:8px; margin-top:7px; margin-left:7px; border:none;';
		}
		if ($this->name == 'jform[sub_arrow_image_normal_preview]'){
			$id = 'sub-arrow_image_normal';
			$file = JURI::root().$this->form->getValue('sub_arrow_image_normal');
			$style = 'width:8px; height:8px; margin-top:7px; margin-left:7px; border:none;';
		}
		if ($this->name == 'jform[sub_arrow_image_over_preview]'){
			$id = 'sub-arrow_image_over';
			$file = JURI::root().$this->form->getValue('sub_arrow_image_over');
			$style = 'width:8px; height:8px; margin-top:7px; margin-left:7px; border:none;';
		}
		if ($this->name == 'jform[sub_arrow_image_active_preview]'){
			$id = 'sub-arrow_image_active';
			$file = JURI::root().$this->form->getValue('sub_arrow_image_active');
			$style = 'width:8px; height:8px; margin-top:7px; margin-left:7px; border:none;';
		}
		if ($this->name == 'jform[menu_back_image_preview]'){
			$id = 'menu-back_image';
			$file = JURI::root().$this->form->getValue('menu_back_image');
			$style = 'width:80px; height:20px; margin-left:4px; margin-top:0px;';
		}
		if ($this->name == 'jform[item_back_image_normal_preview]'){
			$id = 'item-back_image_normal';
			$file = JURI::root().$this->form->getValue('item_back_image_normal');
			$style = 'width:80px; height:20px; margin-left:4px; margin-top:0px;';
		}
		if ($this->name == 'jform[item_back_image_over_preview]'){
			$id = 'item-back_image_over';
			$file = JURI::root().$this->form->getValue('item_back_image_over');
			$style = 'width:80px; height:20px; margin-left:4px; margin-top:0px;';
		}
		if ($this->name == 'jform[item_back_image_active_preview]'){
			$id = 'item-back_image_active';
			$file = JURI::root().$this->form->getValue('item_back_image_active');
			$style = 'width:80px; height:20px; margin-left:4px; margin-top:0px;';
		}
		if ($this->name == 'jform[separator_vimage_preview]'){
			$id = 'separator-vimage';
			$file = JURI::root().$this->form->getValue('separator_vimage');
			$style = 'width:auto; height:auto; margin-left:6px; margin-top:0px;';
		}
		
		$alt = '';
		$attribs = array(
			'id' => $id,
			'style' => $style,
		);
	
		return JHtml::image($file, $alt, $attribs);
	}
}

